<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_Modify_ion_auth extends CI_Migration {

  public function up()
  {
    $fields['mobile'] = array(
                              'type'        => 'INT',
                              'constraint'  => '10',
                              'null'        => TRUE
                            );
    $fields['facebook'] = array(
                              'type'        => 'VARCHAR',
                              'constraint'  => '255',
                              'null'        => TRUE
                            );
    $fields['line'] = array(
                              'type'        => 'VARCHAR',
                              'constraint'  => '255',
                              'null'        => TRUE
                            );
    $fields['gender'] = array(
                              'type'        => 'ENUM("f","m")',
                              'default'     => 'm',
                              'null'        => FALSE
                            );
    $fields['address'] = array(
                              'type'        => 'VARCHAR',
                              'constraint'  => '64',
                              'null'        => TRUE
                            );
    $fields['district'] = array(
                              'type'        => 'VARCHAR',
                              'constraint'  => '45',
                              'null'        => TRUE
                            );
    $fields['province'] = array(
                              'type'        => 'INT',
                              'constraint'  => '2',
                              'null'        => TRUE
                            );
    $fields['zipcode'] = array(
                              'type'        => 'INT',
                              'constraint'  => '5',
                              'null'        => TRUE
                            );
    $this->dbforge->add_column('users', $fields);
  }

  public function down()
  {
    $this->dbforge->drop_column('users', 'phone');
    $this->dbforge->drop_column('users', 'facebook');
    $this->dbforge->drop_column('users', 'line');
    $this->dbforge->drop_column('users', 'gender');
    $this->dbforge->drop_column('users', 'address');
    $this->dbforge->drop_column('users', 'district');
    $this->dbforge->drop_column('users', 'province');
    $this->dbforge->drop_column('users', 'zipcode');
  }
}
